#!/bin/bash

kubectl delete svc springboot
kubectl delete -f /opt/jen-space/springboot.yaml
#这里速度太快会导致docker rmi删不掉，所以停留3秒钟
sleep 3
docker rmi 192.168.63.20:10080/library/springboot:latest
ssh node1 -p 10022 "docker rmi 192.168.63.20:10080/library/springboot:latest"
ssh node2 -p 10022 "docker rmi 192.168.63.20:10080/library/springboot:latest"
ssh node3 -p 10022 "docker rmi 192.168.63.20:10080/library/springboot:latest"

docker login --username=admin --password=Harbor12345  192.168.63.20:10080
docker build -t 192.168.63.20:10080/library/springboot:latest .
docker push 192.168.63.20:10080/library/springboot:latest
docker rmi 192.168.63.20:10080/library/springboot:latest

docker pull 192.168.63.20:10080/library/springboot:latest
kubectl apply -f /opt/jen-space/springboot.yaml
kubectl create svc nodeport  springboot --tcp=8089:8089 --node-port=30101
